﻿using System.Collections.Generic;

namespace StudentsDB
{
    public class GroupsService
    {
        public IList<Groups> GetAllGroups()
        {
            return HibernateTemplate.FindAll<Groups>();
        }

        public Groups GetGroupsById(int? GroupsId)
        {
            return (Groups)HibernateTemplate.GetSession().Get(typeof(Groups), GroupsId);
        }

        public Groups GetGroupsByCode(int GroupsCode)
        {
            return (Groups)HibernateTemplate.GetSession().Get(typeof(Groups), GroupsCode);
        }

        public Groups AddGroups(Groups Groups)
        {
            return (Groups)HibernateTemplate.GetSession().SaveOrUpdateCopy(Groups);
        }

        public Groups UpdateGroups(Groups Groups)
        {
            return (Groups)HibernateTemplate.GetSession().SaveOrUpdateCopy(Groups);
        }

        public void DeleteGroups(Groups Groups)
        {
            HibernateTemplate.GetSession().Delete(Groups);
        }

    }
}
